< previous page page_579 next page >

Page 579
    '
    strMsg = ""
    For intLoop = trcPointer To 1 Step -1
        strMsg = strMsg & Format(intLoop, "000")
        strMsg = strMsg & ": "
        strMsg = strMsg & Trim(trcStack(intLoop))
        strMsg = strMsg & vbCrLf
    Next
    '
    MsgBox strMsg, vbInformation, "Trace Stack"
    '
End Sub
Notice that the code in Listing 14.36 prints the call array in reverse order. This is the conventional way to print trace lists. The top-most entry shows the most recently executed routine, and the bottom-most entry shows the first routine in this trace.
After adding this last code, save and compile the ActiveX DLL and then load your errTest project. After you load the frmTest form, add the following code to the general declarations area of the form.
Public objTrace As Object
Next, update the Form_Load event as shown in Listing 14.37. This adds the use of the trace module to the project.
Type.gifListing 14.37. Updating the Form_Load event to include module tracing.
Private Sub Form_Load()
    '
    Data1.DatabaseName = "junk"
    '
    Set objErr = New errHandler
    Set objTrace = New TraceObject
    '
    objTrace.Push "Form_Load"
    '
    objErr.WriteLogFlag = True
    objErr.LogFileName = App.Path & "\" & App.EXEName & ".log"
    '
    objTrace.Pop
    '
End Sub
Note the use of objTrace.Push to add the name of the method onto the trace stack. This should happen as early as possible in the method code. Note, also the objTrace.Pop line at the very end of the method. This removes the name of the method from the stack just as the method is complete.

 
< previous page page_579 next page >

If you like this book, buy it!